package com.esun.cheetah.view.setting;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;

import com.esun.cheetah.R;
import com.esun.cheetah.view.setting.connect.ConnectionChangeReceiver;

public class HelpDetail extends Activity implements OnClickListener {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.help_details);
		Intent intent = getIntent();
		String url = intent.getStringExtra("url");
		((Button) this.findViewById(R.id.common_web_act_btn_goBack))
				.setOnClickListener(this);
		final View progress = (View) this
				.findViewById(R.id.common_web_act_progress);
		WebView web = (WebView) this.findViewById(R.id.commen_web_web);
		web.setWebViewClient(new WebViewClient() {
			@Override
			public void onPageFinished(WebView view, String url) {
				super.onPageFinished(view, url);
				progress.setVisibility(View.GONE);
			}

			@Override
			public void onPageStarted(WebView view, String url, Bitmap favicon) {
				super.onPageStarted(view, url, favicon);
				progress.setVisibility(View.VISIBLE);
			}
		});
		web.loadUrl(url);
	}

	@Override
	public void onClick(View v) {
		this.finish();
	}

	@Override
	protected void onPause() {
		super.onPause();
		this.unregisterReceiver(ConnectionChangeReceiver
				.getConnectionChangeReceiver());
	}

	@Override
	protected void onResume() {
		super.onResume();
		this.registerReceiver(
				ConnectionChangeReceiver.getConnectionChangeReceiver(),
				ConnectionChangeReceiver.getIntentFilter());
	}

}
